//
//  PersonalInformationModel.m
//  CleanerAir_Project
//
//  Created by 付亚杰 on 16/6/13.
//  Copyright © 2016年 Beijing Colin El Internet. All rights reserved.
//

#import "PersonalInformationModel.h"

@implementation PersonalInformationModel

- (void)setValue:(id)value forKey:(NSString *)key{
    [super setValue:value forKey:key];
    
    if ([key isEqualToString:@"id"]) {
        self.ids = value;
    }
    
    if ([key isEqualToString:@"sex"]) {
        
        self.sexCode = value;
        
        if ([value isEqualToString:@"1"]) {
            self.sex = @"男";
        }else if([value isEqualToString:@"2"]){
            self.sex = @"女";
        }else if([value isEqualToString:@"0"]){
            self.sex = @"保密";
        }
    }
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key{
    
    if ([key isEqualToString:@"oauth"]) {
        
        [self setValuesForKeysWithDictionary:value];
    } 
}

- (void)setSex:(NSString *)sex{
    if (sex != nil) {
        _sex = sex;
        if ([sex isEqualToString:@"男"]) {
            _sexCode = @"1";
        }else if ([sex isEqualToString:@"女"]) {
            _sexCode = @"2";
        }else if ([sex isEqualToString:@"保密"]) {
            _sexCode = @"0";
        }
    }
}

@end
